package org.dromara.common.mqtt.listener;

import lombok.extern.slf4j.Slf4j;
import org.dromara.common.mqtt.client.EmqClient;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;

@Slf4j
public class MqttTopicListener implements ApplicationRunner, Ordered {
    private final EmqClient emqClient;

    public MqttTopicListener(EmqClient emqClient) {
        this.emqClient = emqClient;
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        emqClient.init();
        emqClient.connect("wine-plus-server", "123123");
        log.info("初始化MQTT监听器成功");
    }

    @Override
    public int getOrder() {
        return 0;
    }
}
